<template>
  <div class="paihang">
    <!-- 官方榜 -->
    <div class="guanfang-title">官方榜</div>
    <template v-for="(item, index) in bufengtoplist">
      <router-link
        :to="{path:'/paihang/paihangdetail/id',
        query:{id:item.id,title:item.name,src:item.coverImgUrl}}">
        <div class="bufenglist">
          <div class="left">
            <img :src="item.coverImgUrl" />
          </div>
          <div class="right">
            <template v-for="(li, indx) in item.tracks">
              <div class="name">{{indx+1}}、{{li.first}}-{{li.second}}</div>
            </template>
          </div>
        </div>
      </router-link>
    </template>

    <!-- 推荐榜 -->
    <div class="tuijianbang">推荐榜</div>
    <div class="list">
      <template v-for="(item, index) in toplist">
        <router-link :to="{path:'/paihang/paihangdetail/id',
        query:{id:item.id,title:item.name,src:item.coverImgUrl}}"
       >
          <div class="li">
            <img :src="item.coverImgUrl" />
            <br />
            <span>&nbsp;{{item.name}}</span>
          </div>
        </router-link>
      </template>
    </div>
  </div>
</template>

<script>
import send from "../navshow";
export default {
  data() {
    return {
      toplist: [], //榜单列表
      bufengtoplist: []
    };
  },
  created() {
    send.$emit("tab-show", true); //显示导航栏

     // 显示播放器
    this.$store.commit('showplayer',true)
    
    this.axios.get("http://120.26.184.71:4000/toplist/detail").then(res => {
      this.toplist = res.data.list.slice(5);
      this.bufengtoplist = res.data.list.slice(0, 4);
    });
  },
  methods: {
    
  }
};
</script>

<style>

/* 榜单列表 */
.paihang span {
  color: #222831;
}

/* 官方榜 */
.guanfang-title {
  margin-top: 90px;
  margin-left: 7.5vw;
  font-size: 20px;
  color: #222831;
  font-weight: bold;
  border-left: 5px solid red;
  padding-left: 10px;
  margin-bottom: 20px;
}

.bufenglist {
  width: 85vw;
  margin-left: 7.5vw;
  display: flex;
  margin-top: 10px;
}

.bufenglist .left {
  width: 30vw;
}

.bufenglist .left img {
  width: 100px;
  height: 100px;
  border-radius: 10px;
}
.bufenglist .right {
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  width: 50vw;
}

.bufenglist .name {
  width: 100%;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  color: #333333;
}

/* 推荐榜 */
.tuijianbang {
  margin-top: 20px;
  margin-left: 7.5vw;
  font-size: 20px;
  color: #222831;
  font-weight: bold;
  border-left: 5px solid red;
  padding-left: 10px;
}

.list {
  width: 92vw;
  margin-left: 7.5vw;
  /* margin-top: 10px; */
  display: flex;
  flex-wrap: wrap;
  margin-bottom: 60px;
}

.list .li {
  width: 41vw;
  margin-right: 2.5vw;
  margin-top: 15px;
}

.list .li img {
  width: 90%;
  border-radius: 10px;
}

.list .li span {
  font-size: 12px;
}
</style>